import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Search from '@/views/Search'
import Info from '@/views/Info'
import My from '@/views/My'
import Login from '@/views/Login'
import CityList from '@/views/CityList'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout/home'
  },
  {
    path: '/layout',
    component: Layout,
    children: [
      { path: '/layout/home', component: Home },
      { path: '/layout/search', component: Search },
      { path: '/layout/info', component: Info },
      { path: '/layout/my', component: My }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/citylist',
    component: CityList
  }
]

const router = new VueRouter({
  routes
})

export default router
